/* ast.h

 */

#ifndef AST_H
#define AST_H

#define TRUE 1
#define FALSE 0
#define UNDIF_BOOL -1

// do not change values below, or also edit humanReadableNodeType() in ast.c
#define AT_ID     0
#define AT_NB      1
#define AT_OPADD   2
#define AT_OPSUB   3
#define AT_OPMUL   4
#define AT_OPWRITE 5
#define AT_OPREAD  6
#define AT_OPASS   7
#define AT_OPEQ    8
#define AT_ILIST   9
#define AT_BOOL	  11
#define AT_OPDIV	  12
#define AT_LT	  13
#define AT_LE	  14
#define AT_OR	  15
#define AT_AND	  16
#define AT_NOT	  17
#define AT_DECLARE      18
#define AT_DECLARE_BLOC 19
#define AT_FUNC_HEAD    20
#define AT_FUNC_BODY    21
#define AT_FUNC         22
#define AT_IF           23
#define AT_IF_BODY      24
#define AT_WHILE        25
#define AT_ARGS	  26
#define AT_IMPL   27
#define AT_PROG   28
#define AT_UNKNOWN  29
#define AT_ISET     30
#define AT_VOID     31
#define AT_NEG      32
#define AT_RETURN   33
#define AT_FUNC_CALL 34
#define AT_DEL_FROM 35
#define AT_ADD_TO 36
#define AT_SHARP 37
#define AT_IN 38

struct astnode {
  int type;
  int vtype;
  char * sval;
  int ival;
  int bval;

  struct astnode * left;
  struct astnode * right;
};

typedef struct astnode * ASTTREE;
typedef struct astnode   ASTNODE;

extern ASTTREE createNode(int type, int vtype, int ival,char* sval, int bval, ASTTREE left, ASTTREE right);
extern void freeNode(ASTTREE node);
extern void freeTree(ASTTREE tree);

extern void printTree(ASTTREE tree);

extern ASTTREE inTree(ASTTREE tree, char* node,int vtype);

//20120314 START ADD CODE
extern char* humanReadableNodeType (int type);
//WRITE XML AST Functions
extern void writeToFile(char *outFile, char *textToWrite);
extern void printTreeXML(ASTTREE tree, char* outFile_AST_XML);
//20120314 END 



#endif
